<?php

use Symfony\Component\HttpKernel\Kernel;
use Symfony\Component\Config\Loader\LoaderInterface;

class AppKernel extends Kernel
{
    public function registerBundles()
    {
        $bundles = array(
            //Bundles Originais do Symfony
            new Symfony\Bundle\FrameworkBundle\FrameworkBundle(),
            new Symfony\Bundle\SecurityBundle\SecurityBundle(),
            new Symfony\Bundle\TwigBundle\TwigBundle(),
            new Symfony\Bundle\MonologBundle\MonologBundle(),
            new Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle(),
            new Symfony\Bundle\DoctrineBundle\DoctrineBundle(),
            new Symfony\Bundle\AsseticBundle\AsseticBundle(),
            new Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle(),
            new JMS\SecurityExtraBundle\JMSSecurityExtraBundle(),
            
            //Bundles Friends Of Symfonfy(Controle de Usuarios-parte de banco, e Rotas)
            new FOS\UserBundle\FOSUserBundle(),
            new FOS\JsRoutingBundle\FOSJsRoutingBundle(),
            
            //Bundles Sonata(SonataAdmin, SonataUser e dependencias)
            new Sonata\jQueryBundle\SonatajQueryBundle(),
            new Sonata\BlockBundle\SonataBlockBundle(),
            new Sonata\CacheBundle\SonataCacheBundle(),
            new Sonata\AdminBundle\SonataAdminBundle(),
            new Sonata\DoctrineORMAdminBundle\SonataDoctrineORMAdminBundle(),
            new Sonata\UserBundle\SonataUserBundle('FOSUserBundle'),
            new Sonata\EasyExtendsBundle\SonataEasyExtendsBundle(),
            new Sonata\IntlBundle\SonataIntlBundle(),
            
            //Bundle para Auditoria(historico de transações) (Complemento para o Sonata)
            new SimpleThings\EntityAudit\SimpleThingsEntityAuditBundle(),
            
            //Bundle para Gerar Menus(Complemento para o Sonata)
            new Knp\Bundle\MenuBundle\KnpMenuBundle(),
            
            //Bundle com Extensões para tratamento de tipos de dados(Complemento para o Sonata)
            new Stof\DoctrineExtensionsBundle\StofDoctrineExtensionsBundle(),
            
            //Bundle para Campos com AutoComplementos(Complemento para o Form)
            new Shtumi\UsefulBundle\ShtumiUsefulBundle(),            
            
            //Aplicação para controle de Usuarios(cadastro e manutenção, permissões e Grupos)(Gerado pelo Sonata)
            new Application\Sonata\UserBundle\ApplicationSonataUserBundle(),
            
            //Bundle Para Controle dos Produtos da loja(Desenvolvimento)
            new Ecom\ProdutosBundle\ProdutosBundle(),
        );

        if (in_array($this->getEnvironment(), array('dev', 'test'))) {
            $bundles[] = new Symfony\Bundle\WebProfilerBundle\WebProfilerBundle();
            $bundles[] = new Sensio\Bundle\DistributionBundle\SensioDistributionBundle();
            $bundles[] = new Sensio\Bundle\GeneratorBundle\SensioGeneratorBundle();
        }

        return $bundles;
    }

    public function registerContainerConfiguration(LoaderInterface $loader)
    {
        $loader->load(__DIR__.'/config/config_'.$this->getEnvironment().'.yml');
    }
}
